home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Fading / GreenFade.s < prev    next >
Encoding:
Text File  |  1998-08-03  |  3.3 KB  |  127 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Fades in a 32 colour picture, then up to a specified colour (lime green),
  3. ;and then out to black.  Press left mouse button to exit.
  4.  
  5.     INCDIR    "INCLUDES:"
  6.     INCLUDE    "dpkernel/dpkernel.i"
  7.  
  8.     SECTION    "Demo",CODE
  9.  
  10. ;===========================================================================;
  11. ;                             INITIALISE DEMO
  12. ;===========================================================================;
  13.  
  14.     STARTDPK
  15.  
  16. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  17.     move.l    DPKBase(pc),a6
  18.     lea    FilePic(pc),a0
  19.     moveq    #ID_PICTURE,d0
  20.     CALL    Load
  21.     move.l    d0,Picture
  22.     beq.s    .Exit
  23.  
  24.     moveq    #ID_SCREEN,d0
  25.     CALL    Get
  26.     move.l    d0,Screen
  27.     beq.s    .Exit
  28.  
  29.     move.l    Picture(pc),a0
  30.     move.l    Screen(pc),a1
  31.     CALL    CopyStructure
  32.  
  33.     move.l    Screen(pc),a0
  34.     move.l    GS_Bitmap(a0),a1
  35.     move.l    #BMF_BLANKPALETTE,BMP_Flags(a1)
  36.     sub.l    a1,a1
  37.     CALL    Init
  38.     tst.l    d0
  39.     beq.s    .Exit
  40.  
  41.     move.l    Picture(pc),a0
  42.     move.l    PIC_Bitmap(a0),a0
  43.     move.l    Screen(pc),a1
  44.     move.l    GS_Bitmap(a1),a1
  45.     CALL    Copy
  46.  
  47.     move.l    Screen(pc),a0
  48.     CALL    Show
  49.  
  50.     bsr.s    Main
  51.  
  52. .Exit    move.l    DPKBase(pc),a6
  53.     move.l    Screen(pc),a0
  54.     CALL    Free
  55.     move.l    Picture(pc),a0
  56.     CALL    Free
  57.     MOVEM.L    (SP)+,A0-A6/D1-D7
  58.     moveq    #ERR_OK,d0
  59.     rts
  60.  
  61. ;===========================================================================;
  62. ;                                MAIN CODE
  63. ;===========================================================================;
  64.  
  65. Main:    moveq    #$00,d7    ;d7 = FadeState
  66.     move.l    Screen(pc),a0    ;a0 = Screen
  67.  
  68.     move.l    SCRBase(pc),a6
  69. .f_in    CALL    scrWaitAVBL
  70.     move.l    Screen(pc),a0    ;a0 = Screen
  71.     moveq    #5,d1    ;d1 = Speed of fade.
  72.     move.l    Picture(pc),a5
  73.     move.l    PIC_Bitmap(a5),a5
  74.     move.l    BMP_Palette(a5),a1    ;a5 = Palette to fade to.
  75.     addq.w    #8,a1
  76.     moveq    #$000000,d2    ;d2 = Fading from black.
  77.     moveq    #00,d3    ;d3 = Start colour.
  78.     move.l    BMP_AmtColours(a5),d4    ;d4 = Amount of colours.
  79.     move.w    d7,d0
  80.     CALL    scrColourToPalette    ;Do the fade routine.
  81.     move.w    d0,d7    ;Has the fade finished yet?
  82.     bne.s    .f_in    ;If not, keep doing it.
  83.  
  84.     moveq    #$00,d7    ;d7 = FadeState
  85. .f_mid    CALL    scrWaitAVBL
  86.     move.l    Screen(pc),a0    ;a0 = Screen
  87.     moveq    #2,d1    ;d1 = Speed of fade.
  88.     move.l    BMP_Palette(a5),a1    ;a1 = Palette we are fading from.
  89.     addq.w    #8,a1
  90.     move.l    #$75F343,d2    ;d2 = Colour we are fading to.
  91.     move.w    d7,d0
  92.     CALL    scrPaletteToColour    ;Do the fade routine.
  93.     move.w    d0,d7    ;Has the fade finished yet?
  94.     bne.s    .f_mid    ;If not, keep doing it.
  95.  
  96.     moveq    #$00,d7
  97. .f_out    CALL    scrWaitAVBL
  98.     move.l    Screen(pc),a0    ;a0 = Screen
  99.     move.l    BMP_Palette(a5),a1    ;a1 = Palette we are fading from.
  100.     addq.w    #8,a1
  101.     moveq    #2,d1    ;d1 = Speed of fade.
  102.     move.l    #$a5F343,d2    ;d2 = Colour.
  103.     moveq    #$000000,d5    ;d5 = Colour.
  104.     move.w    d7,d0
  105.     CALL    scrColourMorph    ;Do the fade routine.
  106.     move.w    d0,d7    ;Has the fade finished yet?
  107.     bne.s    .f_out    ;If not, keep doing it.
  108.     rts
  109.  
  110. ;===========================================================================;
  111. ;                                  DATA
  112. ;===========================================================================;
  113.  
  114. Screen:        dc.l  0
  115. Picture:    dc.l  0
  116. FilePic:    FILENAME "GMS:demos/data/PIC.Loading"
  117.  
  118. ;===========================================================================;
  119.  
  120. ProgName:    dc.b  "Green Fade",0
  121. ProgAuthor:    dc.b  "Paul Manias",0
  122. ProgDate:    dc.b  "February 1998",0
  123. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  124. ProgShort:    dc.b  "Fading demonstration.",0
  125.         even
  126.  
  127.